<template>
<view class="container">
  <view class="myde_tq">
		<image src="https://hf.pigcms.com/static/wxapp/right_zs.png"></image>
	</view>
  <view class="myxq">
		<view class="myxq_title">会员特权</view>
		<view class="myxq_mx" id="member_right">{{card_info.info}}</view>
	</view>
</view>
</template>

"<script>
import common from '../../utils/common.js'
var app = getApp();

export default {
  data() {
    return {
      mer_id: 0,
      card_info: {}
    };
  },

  onShareAppMessage: function () {},
  onReachBottom: function () {},
  onPullDownRefresh: function () {},
  onUnload: function () {},
  onHide: function () {},
  onShow: function () {},
  onReady: function () {},
  onLoad: function (options) {
    if (!options.mer_id) {
      options.mer_id = app.merchantOwn.mer_id;
    }

    this.setData({
      mer_id: options.mer_id
    });

    if (!app.globalData.userInfo) {
      var that = this; //调用应用实例的方法获取全局数据

      common.getUserInfo(function (userInfo) {
        if (!userInfo.phone) {
          wx.navigateTo({
            url: "../my/newnumber"
          });
        } else {
          that.setMainContent();
        }
      }, 'setting');
    } else {
      this.setMainContent();
    }
  },
  components: {},
  props: {},
  methods: {
    setMainContent: function () {
      common.post('Wxapp_merchant&a=merchant_card', {
        mer_id: this.mer_id
      }, "setRightContent", this);
    },
    setRightContent: function (result) {
      this.setData({
        card_info: result.card_info
      });
      wx.hideToast();
    },
    setData: function (obj) {
      let that = this;
      let keys = [];
      let val, data;
      Object.keys(obj).forEach(function (key) {
        keys = key.split('.');
        val = obj[key];
        data = that.$data;
        keys.forEach(function (key2, index) {
          if (index + 1 == keys.length) {
            that.$set(data, key2, val);
          } else {
            if (!data[key2]) {
              that.$set(data, key2, {});
            }
          }

          data = data[key2];
        });
      });
    }
  }
};
</script>
<style>
page{
  background:white;
}
.myde_tq {
  width: 100%;
  height: 228rpx;
  padding-top: 44rpx;
  border-bottom: 2rpx solid #8c8c8c;
  background: url(https://hf.pigcms.com/static/wxapp/right_bg4.png) repeat;
  text-align: center;
}
.myde_tq image{
  height:184rpx;
  width:184rpx;
}
.myxq {
  width: 92%;
  padding: 30rpx 4% 0;
}
.myxq_title {
  margin-bottom:16rpx;
}
.myxq_mx {
  width: 100%;
  padding-bottom: 16rpx;
  line-height: 44rpx;
  font-size: 26rpx;
}
</style>